/**
 * 基本指令处理
 * @author tsdy
 * v-text
 * v-show
 * v-resource
 * v-style
 */
import { Pixijsvue } from "../main";
import { Scope } from "../../typings/traverse";
import { Container } from "pixi.js";
import GlobalResource from "../ResourceGlobal";
import { v_show, v_style, v_text, v_resource } from "./basic/index";
import Resource from "../ResourceCenter";
import { DepItem } from "../../typings/dep";

interface DealGoal {
  $data: Record<string, any>;
  $watcher: Record<string, Record<string, Array<Function>>>;
  $resource: Resource | undefined;
  $globalResource?: GlobalResource;
  $id: number;
  $style: Record<string, Function>;
  _depList: Array<DepItem>;
}

function disposeBasic(
  that: Pixijsvue,
  goal: DealGoal,
  container: Container,
  element: Element,
  scope: Scope | undefined
) {
  const {
    $data,
    $watcher,
    $resource,
    $globalResource,
    _depList,
    $style,
    $id,
  } = goal;
  v_text({ $data, $watcher }, container, element, scope);
  v_show({ $data, $watcher }, container, element, scope);
  v_resource(
    { $data, $globalResource, $resource, $watcher },
    container,
    element,
    scope
  );
  v_style(
    that,
    { $data, $id, $style, $watcher, _depList },
    container,
    element,
    scope
  );
}

export { disposeBasic };
